{% set APP_NAME = pillar.get('app_name') %}
{% set COMMIT = pillar['commit'] %}
{% set WORKSPACE = pillar['workspace'] %}
{% set BACKUP_DIR =  pillar['backup_dir'] %}
{% set PRO_NAME = pillar['pro_name'] %}
{% set ENV = pillar['env'] %}

backup_dependency:
  cmd.run:
    - name: |
        cp {{WORKSPACE}}/{{PRO_NAME}}/target/dependency/* {{BACKUP_DIR}}/{{APP_NAME}}/{{COMMIT}}/dependency/
    - onlyif: test -d {{WORKSPACE}}/{{PRO_NAME}}/target/dependency